package com.xhwl.logistics.controller;


import com.xhwl.common.pojo.ResultJson;
import com.xhwl.common.pojo.cent.sdata.Account;
import com.xhwl.common.vo.cent.vehicle.CardVO;
import com.xhwl.logistics.service.IVehcCardService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author Lu.Aaron
 * @since 2021-02-08
 * @menu 车卡
 */
//@RestController
@Slf4j
@RequestMapping("/card")
public class VehcCardController {
    @Autowired
    private IVehcCardService vehcCardService;


    /**
     * 新增车卡
     * @param cardVO
     * @param account
     * @return
     */
    @ResponseBody
    @RequestMapping(value = "/add", method = RequestMethod.POST)
    public ResultJson add(@RequestBody CardVO cardVO, Account account) {

        return  vehcCardService.add(cardVO,account);
    }


    /**
     * 修改车卡
     * @param cardVO
     * @return
     */
    @ResponseBody
    @RequestMapping(value = "/update", method = RequestMethod.POST)
    public ResultJson update(@RequestBody CardVO cardVO) {

        return  vehcCardService.edit(cardVO);
    }

    /**
     * 删除车卡
     * @param id
     * @return
     */
    @ResponseBody
    @RequestMapping(value = "/delete", method = RequestMethod.POST)
    public ResultJson delete( @RequestParam(value = "id") Integer id) {

        return  vehcCardService.delete(id);
    }


}

